<template>
  <div class="data_list_content">
    <div class="data_card" v-for="item in list" v-bind:key="item.id">
      <div class="card_top">
        <img v-if="item.budgetType === 1" src="@/assets/images/list.png" />
        <img v-else src="@/assets/images/package.png" />
      </div>
      <div class="card_content">
        <div class="title">
          {{ item.customerAddress }}
        </div>
        <img class="edit_icon" @click="edit(item)" src="@/assets/images/edit_gery.png" />
        <div class="second">{{ item.customerSummary || "--" }}</div>
        <div class="customer">
          <div class="label">客户</div>
          <div>{{ `${item.customerName} | ${item.customerMobileCode}` }}</div>
          <div class="label">设计师</div>
          <div>
            {{ `${item.designUserName} | ` }}
            <span class="label">
              {{ formatDate(new Date(item.updateTime), "yyyy-MM-dd HH:mm:ss") }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
// 资源导入
import { defineProps, defineEmits } from "vue";
import { formatDate } from "@/utils/formatDate.js";
// 变量定义
const emits = defineEmits(["edit"]);
defineProps({
  list: {
    type: Array,
    default: () => []
  }
});
const edit = item => {
  emits("edit", item);
};
</script>
<style scoped lang="scss">
.data_list_content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(273px, 1fr));
  gap: 20px;
  padding: 5px 20px 20px;
  .data_card {
    min-height: 154px;
    .card_top {
      height: 24px;
    }
    .card_content {
      position: relative;
      box-sizing: border-box;
      min-height: 130px;
      background-color: white;
      border-radius: 0px 4px 4px 4px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      font-size: 12px;
      line-height: 20px;
      color: #86909c;
      border: 1px solid #e5e8ef;
      transition: all 0.2s ease-in-out;
      .title {
        font-size: 14px;
        font-weight: 700;
        width: 200px;
        line-height: 22px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        color: #1d2129;
      }
      .second {
        margin-bottom: 14px;
      }
      .customer {
        display: grid;
        grid-template-columns: 1fr max-content;
        color: #3d3d3d;
      }
      .label {
        color: #86909c;
        width: 38px;
        margin-right: 16px;
      }
      .edit_icon {
        width: 16px;
        height: 16px;
        position: absolute;
        right: 16px;
        top: 18px;
      }
    }
    .card_content:hover {
      box-shadow: 4px 4px 10px 0px rgba(0, 0, 0, 0.1);
    }
  }
}
</style>
